package uit.nfcmenu.db.model;

import uit.nfcmenu.util.ConvertImg;
import android.graphics.Bitmap;


public class ItemModel {
	private int id;
	private int menuId;
	private double price;
	private double discount;
	private String name;
	private String moneyType;
	private String description;
	private String imageLink;
	private Bitmap bitmap;

	public ItemModel() {
		price = 0;
	}
	
	public ItemModel(int itemId, String itemName, int menuId, 
			String imageLink, String description, 
			double price, double discount, Bitmap bitmap) {
		this.id = itemId;
		this.menuId = menuId;
		this.price = price;
		this.discount = discount;
		this.name = itemName;
		this.description = description;
		this.imageLink = imageLink;
		this.bitmap = bitmap;
	}

    // ================================
 	// Others
 	// ================================
    
	@Override
	public String toString() {
		return "id="+id+", "
				+"menuId="+menuId+", "
				+"name="+name+", "
//				+"des="+description+", "
//				+"imageLink="+imageLink+", "
				+"bitmap="+(bitmap==null?"null":(bitmap.getWidth()+"x"+bitmap.getHeight()))
				+"\n";
	}
	
	public void setId(int itemId) {
		this.id = itemId;
	}

	public int getId() {
		return id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setMenuId(int menuId) {
		this.menuId = menuId;
	}

	public int getMenuId() {
		return menuId;
	}

	public void setImageLink(String imageLink) {
		this.imageLink = imageLink;
	}

	public String getImageLink() {
		return imageLink;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}
	
	public double getDiscount() {
		return discount;
	}

	public void setDiscount(double discount) {
		this.discount = discount;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public Bitmap getBitmap() {
		return bitmap;
	}
	
	public void setBitmap(Bitmap bitmap) {
		this.bitmap = bitmap;
	}
	
	public String getBitmapString() {
//		return ConvertImg.getString(bitmap);
		return ConvertImg.encodeBase64(bitmap);
	}
	
	public void setBitmap(String bitmapString) {
//		this.bitmap = ConvertImg.getBitmap(bitmapString);
		this.bitmap = ConvertImg.decodeBase64(bitmapString);
	}

	public String getMoneyType() {
		return moneyType;
	}

	public void setMoneyType(String moneyType) {
		this.moneyType = moneyType;
	}
}